/*
 * light_control.h
 *
 *  Created on: 2010-12-17
 *      Author: minfang
 */

#ifndef LIGHT_CONTROL_H_
#define LIGHT_CONTROL_H_

volatile unsigned int current_light;

void light_init(){

	current_light=22;
}

void show_light() ;
void test_light();
void fetch_light(){

	ADMUX=0x40;
	ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADIE)|0x07;


}

SIGNAL( ADC_vect) {

	unsigned char c1;

	c1 = ADCL;
	current_light = ADCH;
	current_light <<= 8;
	current_light += c1;

	if (current_light > 999) {
		current_light = 999;
	}
	show_light();
	test_light();
}

#endif /* LIGHT_CONTROL_H_ */
